package org.etherframework.tests.features.mediator.mediators
{
	import org.etherframework.common.DestructionPolicy;
	import org.etherframework.common.IManagedDestroyable;
	import org.etherframework.mediator.IActivatable;
	import org.etherframework.mediator.Mediator;
	
	public class ActivatableMediator extends LifecycledMediator implements IActivatable, IManagedDestroyable
	{
		public static const ACTIVATED:String = "activated";
		
		public var destroyed:Boolean;
		public var activated:Boolean;
		// As we test activation by removing/adding to stage we set destruction
		// policy to "never" to to have mediator alive all the time for tests.
		private var _destructionPolicy:String = DestructionPolicy.NEVER;
		
		public function ActivatableMediator()
		{
			super();
		}
		
		public function activate():void
		{
			activated = true;
			lifecycleOrder.push(ACTIVATED);
		}
		
		public function deactivate():void
		{
			activated = false;
		}
		
		public function destroy():void
		{
			destroyed = true;
		}
		
		public function get destructionPolicy():String { return _destructionPolicy; }
		public function set destructionPolicy(value:String):void { _destructionPolicy = value; }
	}
}